﻿/****************************************************************************************************
	Copyright (C) 2010 RapidWebDev Organization (http://rapidwebdev.org)
	Author: Eunge, Legal Name: Jian Liu, Email: eunge.liu@RapidWebDev.org

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 2 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ****************************************************************************************************/

using System;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;

namespace RapidWebDev.SearchIndex.Contract
{
	/// <summary>
	/// Parameters message for search service to execute search.
	/// </summary>
	[Serializable]
	[DataContract(Namespace = ServiceNamespaces.SearchIndexNamespace)]
	public class SearchParameterMessage
	{
		/// <summary>
		/// Index document stemming language.
		/// </summary>
		[DataMember]
		public string StemmingLanguage { get; set; }

		/// <summary>
		/// The application id which the searching is for. The property should not be null or empty.
		/// </summary>
		[DataMember]
		public string ApplicationId { get; set; }

		/// <summary>
		/// The document types to search.
		/// </summary>
		[DataMember]
		public Collection<string> DocumentTypes { get; set; }

		/// <summary>
		/// The searching keyword.
		/// </summary>
		[DataMember]
		public string Keyword { get; set; }

		/// <summary>
		/// The searching filters, defaults to NULL.
		/// </summary>
		[DataMember]
		public Collection<SearchFilterMessage> Filters { get; set; }

		/// <summary>
		/// The searching page size which decides the maximum records returned from search service, defaults to 25.
		/// </summary>
		[DataMember]
		public int PageSize { get; set; }

		/// <summary>
		/// The searching page index which starts from zero, defaults to 0.
		/// </summary>
		[DataMember]
		public int PageIndex { get; set; }

		/// <summary>
		/// The sorting parameter of search results, defaults to NULL which sorts by relevance descendingly.
		/// </summary>
		[DataMember]
		public Collection<SearchSortingParameterMessage> SortingParameter { get; set; }

		/// <summary>
		/// The selector is used to specify which part (fields, attachment or highlight fragment) of searched document should be returned from search service, 
		/// defaults to NULL which returns only the basic properties like Id, DocumentType, IndexedOn etc.
		/// </summary>
		[DataMember]
		public SearchResultSelectorMessage Selector { get; set; }

		/// <summary>
		/// The parameter indicates how to aggregate the searched documents, defaults to NULL.
		/// </summary>
		[DataMember]
		public Collection<SearchWithAggregateFieldMessage> AggregateParameters { get; set; }
	}
}